﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Enterprise.Management.Data;
using Enterprise.Management.Caches;

namespace Enterprise.Management.Business
{
    public class AuditBLL : BaseBLL
    {

        public DP_Audit_Info Get(int id)
        {
            return DataContext.DP_Audit_Info.First(m => m.AdtInf_ID == id);
        }

        public bool Add(DP_Audit_Info dp_audit_info)
        {
            DataContext.DP_Audit_Info.InsertOnSubmit(dp_audit_info);
            return Submit();
        }

        public bool Update(DP_Audit_Info dp_audit_info)
        {
            return Submit();
        }

        public bool Delete(int id)
        {
            DP_Audit_Info dp_audit_info = Get(id);
            dp_audit_info.AdtInf_Status = (int)StatusType.Deleted;
            dp_audit_info.ModifiedBy = HtmlCache.GetUser().User_ID;
            dp_audit_info.ModifiedDate = DateTime.Now;
            return Submit();
        }
    }
}